class Solution {
public:
    int largestRectangleArea(vector<int>& heights) {
        
        int n = heights.size();
        if(n == 0) return 0;

        int area = 0, left = 0, right = 0;
        int min_height = 0;

        while(right < n){
            min_height = (min_height, height[i]);
        }

        return area;
    }
};

// Time execution time 
class Solution {
public:
    int largestRectangleArea(vector<int>& heights) {
        
        int n = heights.size();
        if(n == 0) return 0;

        vector<vector<int>> dp(n, vector<int>(n, 0));
        int area = 0;

        for(int i = 0; i < n; i++){
            dp[i][i] = heights[i];
            area = max(area, dp[i][i]);

            for(int j = i+1; j < n; j++){
                dp[i][j] = min(dp[i][j-1], heights[j]);
                area = max(area, (j-i+1)*dp[i][j]);
            }
        }

        return area;
    }
};